package org.tissou.client.widgets;

import com.google.gwt.user.client.ui.Label;

import org.tissou.client.Services.MonException;

/**
 * Created by IntelliJ IDEA.
 * User: Claire
 * Date: 03/03/2009
 * Time: 21:12:32
 * To change this template use File | Settings | File Templates.
 */
public class Label_MessageInformation extends Label {
  public enum Etat {
    SERVICEMARCHE("service marche"),
    SERVICEPASMARCHE("service pas marche"),
    SERVICEATTENTE("service attente"),
    MAUVAISEENTREE("Mauvaise entree de l'utilisateur"),
    NEUTRE("Neutre");
    private final String vraiNom;

    Etat(String nom) {
      vraiNom = nom;
    }

    public String getVraiNom() {
      return vraiNom;
    }
  }

  public Label_MessageInformation() {
    super();
  }

  public Label_MessageInformation setMessage(Etat etat, String s) throws MonException {
    switch (etat)  {
      case SERVICEMARCHE:
        this.removeStyleName("servicepasmarche");
        this.removeStyleName("serviceattente");
        this.addStyleName("servicemarche");
        this.setText(s);
        return this;
      case SERVICEPASMARCHE:
        this.removeStyleName("servicemarche");
        this.removeStyleName("serviceattente");
        this.addStyleName("servicepasmarche");
        this.setText(s);
        return this;
      case MAUVAISEENTREE:
        this.removeStyleName("servicemarche");
        this.removeStyleName("serviceattente");
        this.addStyleName("servicepasmarche");
        this.setText(s);
        return this;
      case SERVICEATTENTE:
        this.removeStyleName("servicemarche");
        this.removeStyleName("servicepasmarche");
        this.addStyleName("serviceattente");
        this.setText(s);
        return this;
      case NEUTRE:
        this.removeStyleName("servicepasmarche");
        this.removeStyleName("serviceattente");
        this.removeStyleName("servicemarche");
        this.setText("");
        return this;
      default:
        throw new MonException("Etat de Message Serveur non identifie");
    }
  }
}
